/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pt.ua.miect.sd.simuladorpesca.conns;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import pt.ua.miect.sd.simuladorpesca.config.NodeService;

/**
 *
 * @author PedroA
 */
public class SocketWrapper {
    private Socket socket;
    private NodeService endpoit;
    private ObjectInputStream in;
    private ObjectOutputStream out;

    /***
     * Creats
     * @param socket
     * @param targetEndpoint
     * @throws IOException
     */
    public SocketWrapper(Socket socket, NodeService targetEndpoint) throws IOException
    {
        this.socket = socket;
        this.endpoit = targetEndpoint;
        out = new ObjectOutputStream(socket.getOutputStream());
        out.flush();
        in = new  ObjectInputStream(socket.getInputStream());

        
    }

    /**
     * @return the in
     */
    public ObjectInputStream getIn() {
        return in;
    }

    /**
     * @return the out
     */
    public ObjectOutputStream getOut() {
        return out;
    }

    /**
     * @return the endpoit
     */
    public NodeService getService() {
        return endpoit;
    }

    /**
     * gets the socket wrapped
     * @param endpoit the endpoit to set
     */
    public void setService(NodeService endpoit) {
        this.endpoit = endpoit;
    }

    /**
     * sets the socket
     * @return the socket
     */
    public Socket getSocket() {
        return socket;
    }




}
